import java.util.Arrays;

public class Main {
    public static int solution(int[] values) {
        // PLEASE DO NOT MODIFY THE FUNCTION SIGNATURE
        // write code here
        int score = 0;
        for (int i=0; i< values.length-1; i++) {
            for (int j = 0; j< values.length; j++) {
                if ( j<= i) {
                    continue;
                }
                if (score < values[i] + values[j] + i - j) {
                    score = values[i] + values[j] + i - j;
                }
            }
        }

        return score; // Placeholder return
    }

    public static void main(String[] args) {
        System.out.println(solution(new int[]{8, 3, 5, 5, 6}) == 11 ? 1 : 0);
        System.out.println(solution(new int[]{10, 4, 8, 7}) == 16 ? 1 : 0);
        System.out.println(solution(new int[]{1, 2, 3, 4, 5}) == 8 ? 1 : 0);
    }
}